#command
RM		=	@rm -f
CP		=	@cp
ECHO    =   @echo
BS      =   buildserver

#TUXEDO
RSM     =   Oracle_XA

BLP		=	$(APPL)/balpro
PUBPATH	= /usr/funddev2/funddev

#include
ORA_INC = $(ORACLE_HOME)/precomp/public
TX_INC  =   $(TUXDIR)/include
APP_INC  =   $(PUBPATH)/inc/db
PUB_INC  =   $(PUBPATH)/inc/pub
PUB_INC2  =   $(PUBPATH)/inc

PROC=proc
PROCFLAGS= include=$(TX_INC) include=$(APP_INC) include=$(PUB_INC) include=$(PUB_INC2) lines=yes sqlcheck=semantics userid=$(DBUSER)/$(DBPWD)@$(ORACLE_SID)

CC= cc
CFLAGS=  -g -q64 -I$(ORA_INC) -I$(TX_INC) -I$(APP_INC) -I$(PUB_INC) -I$(PUB_INC2)

LD= gcc
LIBDIR= -L$(TUXDIR)/lib -ltux
APP_LIB= -L$(PUBPATH)/lib -lpub
ORALIBS= -L$(ORACLE_HOME)/lib -lclntsh `cat $(ORACLE_HOME)/lib/sysliblist`
LIBS= $(LIBDIR) $(ORALIBS) $(APP_LIB)

APPDIR=$(APPL)/bin

OBJS_ACCT_UNFREEZE = acct_unfreeze.o
OBJS_ACCT_UNLOCK = acct_unlock.o
OBJS_ACK_AGG = ack_agg.o
OBJS_ACK_CHECK_ACCT = ack_check_acct.o
OBJS_ACK_CHECK_TRANS = ack_check_trans.o
OBJS_ACK_CLEAR_ACCT = ack_clear_acct.o
OBJS_ACK_CLEAR_INIT = ack_clear_init.o
OBJS_ACK_CLEAR_TRANS = ack_clear_trans.o
OBJS_ACK_PRECLEAR_ACCT = ack_preclear_acct.o
OBJS_ACK_PRECLEAR_TRANS = ack_preclear_trans.o
OBJS_TAACK_IMPORT = taack_import.o
OBJS_APP_AGG = app_agg.o
OBJS_APP_EXPORT_ACCT = app_export_acct.o
OBJS_APP_EXPORT_TRANS = app_export_trans.o
OBJS_TAAPP_EXPORT = taapp_export.o
OBJS_DAY_CHECK = day_check.o
OBJS_DAY_CHECK_NEXT = day_check_next.o
OBJS_DAY_CLOSE = day_close.o
OBJS_DAY_END = day_end.o
OBJS_DAY_OPEN = day_open.o
OBJS_JSZ_EXPORT = jsz_export.o
OBJS_TANAV_CHECK = tanav_check.o
OBJS_TANAV_IMPORT = tanav_import.o
OBJS_ORDER_AGG = order_agg.o
OBJS_ORDER_CLEAR_ACCT = order_clear_acct.o
OBJS_ORDER_CLEAR_TRANS = order_clear_trans.o
OBJS_ORDER_GEN_SAVING = order_gen_saving.o
OBJS_PARAM_CHECK = param_check.o

ACCT_UNFREEZE = $(HOME)/funddev/bin/batch/acct_unfreeze
ACCT_UNLOCK = $(HOME)/funddev/bin/batch/acct_unlock
ACK_AGG = $(HOME)/funddev/bin/batch/ack_agg
ACK_CHECK_ACCT = $(HOME)/funddev/bin/batch/ack_check_acct
ACK_CHECK_TRANS = $(HOME)/funddev/bin/batch/ack_check_trans
ACK_CLEAR_ACCT = $(HOME)/funddev/bin/batch/ack_clear_acct
ACK_CLEAR_INIT = $(HOME)/funddev/bin/batch/ack_clear_init
ACK_CLEAR_TRANS = $(HOME)/funddev/bin/batch/ack_clear_trans
ACK_PRECLEAR_ACCT = $(HOME)/funddev/bin/batch/ack_preclear_acct
ACK_PRECLEAR_TRANS = $(HOME)/funddev/bin/batch/ack_preclear_trans
TAACK_IMPORT = $(HOME)/funddev/bin/batch/taack_import
APP_AGG = $(HOME)/funddev/bin/batch/app_agg
APP_EXPORT_ACCT = $(HOME)/funddev/bin/batch/app_export_acct
APP_EXPORT_TRANS = $(HOME)/funddev/bin/batch/app_export_trans
TAAPP_EXPORT = $(HOME)/funddev/bin/batch/taapp_export
DAY_CHECK = $(HOME)/funddev/bin/batch/day_check
DAY_CHECK_NEXT = $(HOME)/funddev/bin/batch/day_check_next
DAY_CLOSE = $(HOME)/funddev/bin/batch/day_close
DAY_END = $(HOME)/funddev/bin/batch/day_end
DAY_OPEN = $(HOME)/funddev/bin/batch/day_open
JSZ_EXPORT = $(HOME)/funddev/bin/batch/jsz_export
TANAV_CHECK = $(HOME)/funddev/bin/batch/tanav_check
TANAV_IMPORT = $(HOME)/funddev/bin/batch/tanav_import
ORDER_AGG = $(HOME)/funddev/bin/batch/order_agg
ORDER_CLEAR_ACCT = $(HOME)/funddev/bin/batch/order_clear_acct
ORDER_CLEAR_TRANS = $(HOME)/funddev/bin/batch/order_clear_trans
ORDER_GEN_SAVING = $(HOME)/funddev/bin/batch/order_gen_saving
PARAM_CHECK = $(HOME)/funddev/bin/batch/param_check

all: Mstart \
		$(ACCT_UNFREEZE) \
		$(ACCT_UNLOCK) \
		$(ACK_AGG) \
		$(ACK_CHECK_ACCT) \
		$(ACK_CHECK_TRANS) \
		$(ACK_CLEAR_ACCT) \
		$(ACK_CLEAR_INIT) \
		$(ACK_CLEAR_TRANS) \
		$(ACK_PRECLEAR_ACCT) \
		$(ACK_PRECLEAR_TRANS) \
		$(TAACK_IMPORT) \
		$(APP_AGG) \
		$(APP_EXPORT_ACCT) \
		$(APP_EXPORT_TRANS) \
		$(TAAPP_EXPORT) \
		$(DAY_CHECK) \
		$(DAY_CHECK_NEXT) \
		$(DAY_CLOSE) \
		$(DAY_END) \
		$(DAY_OPEN) \
		$(JSZ_EXPORT) \
		$(TANAV_CHECK) \
		$(TANAV_IMPORT) \
		$(ORDER_AGG) \
		$(ORDER_CLEAR_ACCT) \
		$(ORDER_CLEAR_TRANS) \
		$(ORDER_GEN_SAVING) \
		$(PARAM_CHECK) \
		Mcomplete

Mstart:
	$(ECHO)
	$(ECHO) "MAKE server:pack ..."
	$(ECHO)
	$(RM) $(TARGET)

Mcomplete:
	$(ECHO)
	$(ECHO) "MAKE server:pack completed."
	$(ECHO)

$(ACCT_UNFREEZE): $(OBJS_ACCT_UNFREEZE)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACCT_UNFREEZE) $(LIBS)
	$(RM) *.o

$(ACCT_UNLOCK): $(OBJS_ACCT_UNLOCK)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACCT_UNLOCK) $(LIBS)
	$(RM) *.o

$(ACK_AGG): $(OBJS_ACK_AGG)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_AGG) $(LIBS)
	$(RM) *.o

$(ACK_CHECK_ACCT): $(OBJS_ACK_CHECK_ACCT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_CHECK_ACCT) $(LIBS)
	$(RM) *.o

$(ACK_CHECK_TRANS): $(OBJS_ACK_CHECK_TRANS)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_CHECK_TRANS) $(LIBS)
	$(RM) *.o

$(ACK_CLEAR_ACCT): $(OBJS_ACK_CLEAR_ACCT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_CLEAR_ACCT) $(LIBS)
	$(RM) *.o

$(ACK_CLEAR_INIT): $(OBJS_ACK_CLEAR_INIT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_CLEAR_INIT) $(LIBS)
	$(RM) *.o

$(ACK_CLEAR_TRANS): $(OBJS_ACK_CLEAR_TRANS)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_CLEAR_TRANS) $(LIBS)
	$(RM) *.o
	
$(ACK_PRECLEAR_ACCT): $(OBJS_ACK_PRECLEAR_ACCT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_PRECLEAR_ACCT) $(LIBS)
	$(RM) *.o

$(ACK_PRECLEAR_TRANS): $(OBJS_ACK_PRECLEAR_TRANS)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ACK_PRECLEAR_TRANS) $(LIBS)
	$(RM) *.o


$(TAACK_IMPORT): $(OBJS_TAACK_IMPORT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_TAACK_IMPORT) $(LIBS)
	$(RM) *.o

$(APP_AGG): $(OBJS_APP_AGG)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_APP_AGG) $(LIBS)
	$(RM) *.o

$(APP_EXPORT_ACCT): $(OBJS_APP_EXPORT_ACCT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_APP_EXPORT_ACCT) $(LIBS)
	$(RM) *.o

$(APP_EXPORT_TRANS): $(OBJS_APP_EXPORT_TRANS)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_APP_EXPORT_TRANS) $(LIBS)
	$(RM) *.o
	
$(TAAPP_EXPORT): $(OBJS_TAAPP_EXPORT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_TAAPP_EXPORT) $(LIBS)
	$(RM) *.o

$(DAY_CHECK): $(OBJS_DAY_CHECK)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_DAY_CHECK) $(LIBS)
	$(RM) *.o

$(DAY_CHECK_NEXT): $(OBJS_DAY_CHECK_NEXT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_DAY_CHECK_NEXT) $(LIBS)
	$(RM) *.o

$(DAY_CLOSE): $(OBJS_DAY_CLOSE)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_DAY_CLOSE) $(LIBS)
	$(RM) *.o

$(DAY_END): $(OBJS_DAY_END)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_DAY_END) $(LIBS)
	$(RM) *.o

$(DAY_OPEN): $(OBJS_DAY_OPEN)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_DAY_OPEN) $(LIBS)
	$(RM) *.o

$(JSZ_EXPORT): $(OBJS_JSZ_EXPORT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_JSZ_EXPORT) $(LIBS)
	$(RM) *.o

$(TANAV_CHECK): $(OBJS_TANAV_CHECK)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_TANAV_CHECK) $(LIBS)
	$(RM) *.o

$(TANAV_IMPORT): $(OBJS_TANAV_IMPORT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_TANAV_IMPORT) $(LIBS)
	$(RM) *.o

$(ORDER_AGG): $(OBJS_ORDER_AGG)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ORDER_AGG) $(LIBS)
	$(RM) *.o

$(ORDER_CLEAR_ACCT): $(OBJS_ORDER_CLEAR_ACCT)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ORDER_CLEAR_ACCT) $(LIBS)
	$(RM) *.o

$(ORDER_CLEAR_TRANS): $(OBJS_ORDER_CLEAR_TRANS)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ORDER_CLEAR_TRANS) $(LIBS)
	$(RM) *.o

$(ORDER_GEN_SAVING): $(OBJS_ORDER_GEN_SAVING)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_ORDER_GEN_SAVING) $(LIBS)
	$(RM) *.o

$(PARAM_CHECK): $(OBJS_PARAM_CHECK)
	$(CC) -o  $@  $(CFLAGS) -g $(OBJS_PARAM_CHECK) $(LIBS)
	$(RM) *.o

# implicit

.SUFFIXES:
.SUFFIXES: .pc .c .o

.pc.o:
	$(PROC) $(PROCFLAGS) $<
	$(CC) -o $@ $(CFLAGS) -c $(*F).c
	$(RM) tp* *.lis $*.c

.c.o:
	$(CC) -o $@ $(CFLAGS) -c $<
 
.c:
	$(CC) -o $@ $(CFLAGS) $* $(LIBS)

.DEFAULT:
	$(CC) -o $@ $(CFLAGS) $(@F) $(LIBS)
